package until
import (
	"gintest/core/drive"
	"gintest/core/config"
	"time"
)
func InitTask(){
	//botldb管理
	if config.Sconfig.Read("token","type")=="boltdb"{
		go func(){
			for {
				t := time.NewTicker(time.Second * 86400)
				t2 := time.NewTicker(time.Second * 86400)
				for {
					select {
					case _ = <-t.C:
						go drive.BoltdbExpire("token")
					case _ = <-t2.C:
						go drive.BoltdbRepeat("token")
					}
				}
			}
		}()
	}else if config.Sconfig.Read("token","type")=="memory"{
		go func(){
			for {
				t := time.NewTicker(time.Second * 86400)
				t2 := time.NewTicker(time.Second * 86400)
				for {
					select {
					case _ = <-t.C:
						go drive.MemoryExpire()
					case _ = <-t2.C:
						go drive.MemoryRepeat()
					}
				}
			}
		}()
	}
}